#include <iostream>
using namespace std;

signed main()
{
    int a1,a2,b1,b2,c1,c2;
    scanf("%d.%d.%d %d.%d.%d",&a1,&b1,&c1,&a2,&b2,&c2);
    if(c1+c2>=29)    b1++;
    c1 = (c1+c2)%29;
    if(b1+b2>=17)    a1++;
    b1 = (b1+b2)%17;
    a1 += a2;
    printf("%d.%d.%d",a1,b1,c1);
    return 0;
}
